    //
//  InboxOverviewController.m
//  studip
//
//  Created by Rafael Bugajewski on 07/05/10.
//  Copyright 2010 Juicy Cocktail. All rights reserved.
//

#import "InboxOverviewController.h"
#import "NSDate-Misc.h"

@implementation InboxOverviewController

- (void)dealloc
{
	[super dealloc];
}

- (void)didReceiveMemoryWarning
{
  // Releases the view if it doesn't have a superview.
  [super didReceiveMemoryWarning];
  
  // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload
{
  [super viewDidUnload];
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
}

- (void)popToLauncherView
{
  [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)loadView
{
	[super loadView];
  
  [self.navigationItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"eingangsbildschirm"] style:UIBarButtonItemStyleBordered target:self action:@selector(popToLauncherView)] autorelease] animated:YES];
}

- (id)init
{
	if (self = [super init])
  {
		self.tableViewStyle = UITableViewStylePlain;
		self.variableHeightRows = YES;
		self.title = @"Post";
//    
//    + (id)itemWithTitle:(NSString*)title caption:(NSString*)caption text:(NSString*)text
//  timestamp:(NSDate*)timestamp imageURL:(NSString*)imageURL URL:(NSString*)URL;
    
    TTTableMessageItem *t1 = [TTTableMessageItem itemWithTitle:@"Bob der Baumeister" caption:@"Abgabeschluss" text:@"Morgen ist Abgabgeschluss und ich habe 0 Seiten geschrieben. Was machen wir jetzt?" timestamp:[NSDate date] imageURL:@"bundle://news_bob.png" URL:@"tt://about/story"];
    TTTableMessageItem *t2 = [TTTableMessageItem itemWithTitle:@"Darth Vader" caption:@"Herrschaft" text:@"Gemeinsam können wir als Vater und Sohn über die Galaxis herrschen!" timestamp:[[NSDate date]dateByAddingDays:-3] imageURL:@"bundle://news_darth.png" URL:@"fb://inboxDetails"];
    TTTableMessageItem *t3 = [TTTableMessageItem itemWithTitle:@"Heather Brooke" caption:@"Meet tomorrow?" text:@"Meat tomorrow, arghahahaghaghahaha!" timestamp:[[NSDate date]dateByAddingDays:-5] imageURL:@"bundle://news_heather.png" URL:@"tt://about/story"];
    TTTableMessageItem *t4 = [TTTableMessageItem itemWithTitle:@"Lucy Pinder" caption:@"Winchester FTW" text:@"My TV career is awesome. Do you want to shoot a movie with me?" timestamp:[[NSDate date]dateByAddingDays:-6] imageURL:@"bundle://news_lucy.png" URL:@"tt://about/story"];
    TTTableMessageItem *t5 = [TTTableMessageItem itemWithTitle:@"Aishwarya Sakhuja" caption:@"India is the coolest country in town" text:@"Heyah, I have a Facebook page. Do you want to check it out?" timestamp:[[NSDate date]dateByAddingDays:-9] imageURL:@"bundle://news_india.png" URL:@"tt://about/story"];
    TTTableMessageItem *t6 = [TTTableMessageItem itemWithTitle:@"Stevie Leow" caption:@"Leow sounds like meeoow!" text:@"My Twitter account is better than the crappy Facebook page of Aishwarya" timestamp:[[NSDate date]dateByAddingDays:-30] imageURL:@"bundle://news_stevie.png" URL:@"tt://about/story"];
    TTTableMessageItem *t7 = [TTTableMessageItem itemWithTitle:@"Katy Perry" caption:@"Travis McCoy is a loser" text:@"Don‘t tell anybody that I want to break up with him. Did I mention that my Wikipedia page is too long?" timestamp:[[NSDate date]dateByAddingDays:-300] imageURL:@"bundle://news_kate.png" URL:@"tt://about/story"];
    
    self.dataSource = [TTListDataSource dataSourceWithObjects:t1, t2, t3, t4, t5, t6, t7, nil];
    
//		
//		NSMutableArray* items = [[NSMutableArray alloc] init];
//		NSMutableArray* sections = [[NSMutableArray alloc] init];
//		NSMutableArray* itemRows = [[NSMutableArray alloc] init];
//		
//		
//		[sections addObject:@"Designing user experiences"];
//		[itemRows addObject:[TTTableSubtextItem
//                         itemWithText: @"File added"
//                         caption: @"Slides/Session 01.pdf"
//                         URL: @"fb://courseDetails/1/files/1"
//                         accessoryURL: @"fb://courseDetails/1/files/1"]];	
//		[itemRows addObject:[TTTableTextItem
//                         itemWithText: @"Quickinfo changed"
//                         URL: @"fb://courseDetails/1"
//                         accessoryURL: @"fb://courseDetails/1"]];
//		[items addObject: itemRows];
//		
//		TT_RELEASE_SAFELY(itemRows);
//		itemRows = [[NSMutableArray  alloc] init];
//		
//		
//		[sections addObject:@"Theoretische Informatik 2"];
//		[itemRows addObject:[TTTableSubtextItem
//                         itemWithText: @"New Forum post"
//                         caption: @"Fragen zu Zettel4"
//                         URL: @"fb://courseDetails/2"
//                         accessoryURL: @"fb://courseDetails/2"]];
//		[items addObject: itemRows];
//		
//		TT_RELEASE_SAFELY(itemRows);
//		itemRows = [[NSMutableArray  alloc] init];
//		
//		
//		[sections addObject:@"Informatik und Gesellschaft"];
//		[itemRows addObject:[TTTableSubtextItem
//                         itemWithText: @"New Wiki entry"
//                         caption: @"Fachgesprächtermine"
//                         URL: @"fb://courseDetails/3/wiki/1"
//                         accessoryURL: @"fb://courseDetails/3/wiki/1"]];
//		[itemRows addObject:[TTTableSubtextItem
//                         itemWithText: @"New News"
//                         caption: @"Seminar am 16.04.09"
//                         URL: @"fb://courseDetails/3/news/1"
//                         accessoryURL: @"fb://courseDetails/3/news1"]];
//		[items addObject: itemRows];
//		
//		
//		
//		TTListDataSource* ds = [[TTSectionedDataSource alloc] autorelease];
//		ds.sections = sections;
//		ds.items = items;
//		self.dataSource = ds;
//		
//		TT_RELEASE_SAFELY(sections);
//		TT_RELEASE_SAFELY(items);
	}
	
	return self;
}

@end
